<div class = "pt-set-wrap">
    <div class = "pt-set-box">
        <div class = "pt-tab">
            <div class = "pt-tab-nav">
                <a href = "#" class = "current"><span>基本信息</span></a>
                <a href = "#"><span>附加信息</span></a>
            </div>
            <div class = "pt-tab-content">
                <form action = "__URL__/insert" method = "post" enctype = "multipart/form-data" id = "form">
                    <div class = "pt-tab-item">
                        <div class = "pt-set-content">
                            <div class = "pt-set-info">
                                <div class = "line">
                                    <b>所属分类：</b>
                                    <select class = "input-box w160" name = "category_id">
                                        <option value = "">-请选择-</option>
                                        {loop="categorylist"}
                                        <option value = "{$loop.id}">{$loop.name}</option>
                                        {/loop}
                                    </select>
                                </div>
                            </div>
                            <div class = "pt-set-info">
                                <div class = "line">
                                    <b>{$typename}标题：</b>
                                    <input name = "title" type = "text" value = "" class = "input-text w450" />
                                </div>
                            </div>
                            <!--div class = "pt-set-info">
                                <div class = "line">
                                    <b>{$typename}缩略名：</b>
                                    <input name = "key" type = "text" value = "" class = "input-text w450" />
                                </div>
                            </div-->
                            <div class = "pt-set-info">
                                <div class = "line">
                                    <b>{$typename}缩略图：</b>
                                    <input name = "thumb" type = "text" value = "" class = "input-text w450 insertimagevalue" id = "litpic" />
                                    <input type = "file" name = "image" class="insertimage uploadfileinput f-dn " id="insertimagevalue"/>
                                    <input class = "btn btn-primary btn-sm uploadfile" type = "button" value = " 上传图片 " id = "insertimage" />
                                </div>
                            </div>
                            <div class = "pt-set-info">
                                <div class = "line">
                                    <b>图集列表：</b>
                                    <input name = "pictureurls" type = "text" value = "" class = "input-text w450 insertsoftvalue" id = "downlinkurl" />
                                    <input type = "file" name = "image" class="insertsoft uploadfileinput f-dn" id="insertsoftvalue"/>
                                    <input class = "btn btn-primary btn-sm uploadfile" type = "button" value = " 上传图片 " id = "insertsoft" />
                                </div>
                            </div>
                            <!--div class = "pt-set-info" id="downlinkbox">
                                <div class = "line">
                                    <b>分流下载：</b>
                                    <select class = "input-box" name = "downlinktype[]">
                                        {loop="pt.config.global_downtype"}
                                        <option value = "{$key}">{$loop}</option>
                                        {/loop}
                                    </select>
                                    <input name = "downlinkurl[]" type = "text" value = "" class = "input-text w450" />
                                    <input class = "btn btn-default btn-sm downlinkdel" type = "button" value = " 删除本条 " />
                                    <input class = "btn btn-warning btn-sm" type = "button" value = " 增加分流 " id = "downlinkbtn" /><br />
                                </div>
                            </div>
                            <div class = "pt-set-info">
                                <div class = "line">
                                    <b>{$typename}标签：</b>
                                    <input name = "keywords" type = "text" value = "" class = "input-text w450" data-tip = "请使用, | ，字符分隔不同关键字，系统会自动整理为英文逗号！" />
                                </div>
                            </div-->
                            <div class = "pt-set-info">
                                <div class = "line">
                                    <b>{$typename}内容：</b>
                                    <textarea name = "content" class = "simditorarea input-box" style = "width:740px;height:250px;"></textarea>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class = "pt-tab-item">
                        <div class = "pt-set-content">
                            <div class = "pt-set-info">
                                <div class = "line">
                                    <b>关键词：</b>
                                    <input name = "keywords" type = "text" value = "" class = "input-text w450" />
                                </div>
                            </div>
                            <div class = "pt-set-info">
                                <div class = "line"><b>描述：</b>
                                    <textarea name = "description" class = "input-box" style = "width:450px;height:5em"></textarea>
                                </div>
                            </div>
                            <div class = "pt-set-info">
                                <div class = "line">
                                    <b>发布时间：</b>
                                    <input name = "datetime" type = "text" value = "{$pt.now_time|date='Y-m-d H:i:s'}" class = "input-text w450 datetime" />
                                </div>
                            </div>
                            <!--div class = "pt-set-info">
                                <div class = "line">
                                    <b>发布时间：</b>
                                    <input name = "updatetime" type = "text" value = "{$pt.now_time|date='Y-m-d H:i:s'}" class = "input-text w450 datetime" />
                                </div>
                            </div-->
                            <!--div class = "pt-set-info">
                                <div class = "line"><b>点击数：</b>
                                    <input name = "viewnum" type = "text" value = "0" class = "input-text" />
                                </div>
                            </div>
                            <div class = "pt-set-info">
                                <div class = "line"><b>评论数：</b>
                                    <input name = "commentnum" type = "text" value = "0" class = "input-text" />
                                </div>
                            </div>
                            <div class = "pt-set-info">
                                <div class = "line"><b>收藏数：</b>
                                    <input name = "marknum" type = "text" value = "0" class = "input-text" />
                                </div>
                            </div-->
							<div class = "pt-set-info">
                                <div class = "line"><b>权重：</b>
                                    <input name = "weight" type = "text" value = "0" class = "input-text" />
                                </div>
                            </div>
                            <div class = "pt-set-info">
                                <div class = "line"><b>是否置顶：</b>
                                    <select class = "input-box w160" name = "top">
                                        <!--option value = "3">全局置顶</option>
                                        <option value = "2">栏目置顶</option-->
                                        <option value = "1">分类置顶</option>
                                        <option value = "0" selected>不置顶</option>
                                    </select>
                                </div>
                            </div>
                            <!--div class = "pt-set-info">
                                <div class = "line"><b>是否推荐：</b>
                                    <select class = "input-box w160" name = "good">
                                        <option value = "5">推荐等级五</option>
                                        <option value = "4">推荐等级四</option>
                                        <option value = "3">推荐等级三</option>
                                        <option value = "2">推荐等级二</option>
                                        <option value = "1">推荐等级一</option>
                                        <option value = "0" selected>不推荐</option>
                                    </select>
                                </div>
                            </div-->
                            <div class = "pt-set-info">
                                <div class = "line"><b>{$typename}状态：</b>
                                    <label>
                                        <input name = "status" type = "radio" value = '1' checked = 'checked' />
                                        正常发布&nbsp;&nbsp;&nbsp;&nbsp;
                                    </label>
                                    <label>
                                        <input name = "status" type = "radio" value = "0" />
                                        草稿箱&nbsp;&nbsp;&nbsp;&nbsp;
                                    </label>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class = "pt-tab-button">
                        <div class = "pt-set-info">
                            <div class = "line">
                                <b></b>
                                <input class = "btn btn-success" type = "submit" value = " {$actionname} " />&nbsp;&nbsp;&nbsp;
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div class = "f-clear"></div>
    </div>
</div>
<div id = "downlinkcon" class="f-dn">
    <div class = "line">
        <b>&nbsp;</b>
        <select class = "input-box" name = "downlinktype[]">
            {loop="pt.config.global_downtype"}
            <option value = "{$key}">{$loop}</option>
            {/loop}
        </select>
        <input name = "downlinkurl[]" type = "text" value = "" class = "input-text w450" />
        <input class = "btn btn-default btn-sm downlinkdel" type = "button" value = " 删除本条 " />
    </div>
</div>
<script type = "text/javascript" src = "__PUBLIC__/plugin/validator/jquery.validator.js"></script>
<script type = "text/javascript" src = "__PUBLIC__/plugin/datepicker/WdatePicker.js"></script>
{include file="/template/default/common/simditor.html"}
<script type = "text/javascript">
    $(function () {
        var uploader = simple.uploader({
            url: '{link=common.public.uploadfile}'
        });
        $('.uploadfile').on('click',function(){
           var id=$(this).attr('id');
            $('.'+id).val('').trigger('click');
        });
        $('.uploadfileinput').on('change', function() {
            var id=$(this).attr('id');
            uploader.upload(this);
            uploader.on('uploadsuccess', function(e, file, result) {
                $('.'+id).val(result.file_path);
            });
        });
        $('#downlinkbtn').click(function () {
            $('#downlinkbox').append($('#downlinkcon').html());
        });
        $('.downlinkdel').on('click',function () {
            $(this).parent().remove();
        });
        $('#form').validator({
            stopOnError: true,
            timely: 2,
            fields: {
                "category_id": {
                    rule: "required",
                    tip: "请选择{$typename}分类信息!",
                    msg: {
                        required: "请选择{$typename}分类信息!"
                    }
                },
                "title": {
                    rule: "required",
                    tip: "请输入{$typename}标题",
                    msg: {
                        required: "{$typename}标题必填!"
                    }
                }
            },
            //验证成功
            valid: function (form) {
                var sbtn=$('input[type=submit]');
                sbtn.val('正在提交......').attr('disabled','disabled');
                $.ajax({
                    url: $(form).attr('action'),
                    type: 'POST',
                    data: $(form).serialize(),
                    success: function (res) {
                        sbtn.val('{$actionname}').removeAttr('disabled');
                        if (res.status) {
                            $.admin.tool.successtip('添加{$typename}成功', $('input[type=submit]'), res.url);
                        } else {
                            $.admin.tool.errortip('添加{$typename}失败！' + res.info, $('input[type=submit]'));
                        }
                    }
                });
            }
        });
    });
</script>